<template>
	<view>
		<!-- <button @click="showPopup">点击打开</button>
		<uni-popup :visible="showPopup" @close="showPopup" mode="center">
			<view class="popup-content">
				<view v-for="(item, index) in appointmentData" :key="index">{{item}}</view>
			</view>
		</uni-popup> -->

		<button type="warn" @click="GetCustomerService">点击打开</button>

		<!-- 弹出层部分 -->
		<view class="bottomView">
			<view>
				<!-- 普通弹窗 -->
				<uni-popup ref="popup" background-color="#fff" :mask-click="false">
					<view style="text-align: center;margin-top: 30rpx;">预约时间<!-- （2023-3-12 11:00） --></view>
					<!-- <text style="margin-left: 10rpx;">立即预约</text> -->

					<!-- 中间日期时间选择 -->
					<view class="popup-content">
						<view class="example-body">
							<uni-datetime-picker type="datetime" v-model="datetimesingle" @change="changeLog" />
						</view>
					</view>

					<view style="display: flex; padding-bottom: 20rpx;">
						<button style="width: 200rpx;font-size: 30rpx; background-color: white;"
							@click="close()">取消</button>
						<button style="width: 200rpx;font-size: 30rpx;background-color: white;"
							@click="close()">确认</button>
					</view>

				</uni-popup>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

				datetimesingle: '',
			}
		},
		watch: {
			datetimesingle(newval) {
				console.log('单选:', this.datetimesingle);
			}
		},
		mounted() {
			setTimeout(() => {
				this.datetimesingle = Date.now() - 2 * 24 * 3600 * 1000

			}, 3000)
		},
		methods: {
			GetCustomerService() {
				this.$refs.popup.open('bottom');
				this.showPicker = true
			},
			handleDateTimeChange(e) {
				this.selectedDateTime = e.detail.value;
				this.showPicker = false;
			},
			onLoad(options) {
				console.log(options);
			},
			// 底部弹出框关闭方法
			close() {
				this.$refs.popup.close()
			},
			change(e) {
				this.single = e
				console.log('change事件:', this.single = e);
			},
			changeLog(e) {
				console.log('change事件:', e);
			},
			maskClick(e) {
				console.log('maskClick事件:', e);
			}
		}
	}
</script>

<style>
	.popup-content {
		background-color: white;
		border-radius: 10px;
		padding: 20px;
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.example-body {
		background-color: #fff;
		padding: 10px;
	}
</style>